# Contributor: Fabio Ribeiro <fabiorphp@gmail.com>
# Maintainer: Andy Postnikov <apostnikov@gmail.com>
pkgname=php81-pecl-mongodb
_extname=mongodb
pkgver=1.18.1
pkgrel=0
pkgdesc="PHP 8.1 MongoDB driver - PECL"
url="https://pecl.php.net/package/mongodb"
arch="all"
license="Apache-2.0"
depends="php81-common"
makedepends="cyrus-sasl-dev icu-dev openssl-dev>3 php81-dev snappy-dev zstd-dev"
source="php-pecl-$_extname-$pkgver.tgz::https://pecl.php.net/get/$_extname-$pkgver.tgz"
builddir="$srcdir"/$_extname-$pkgver
provides="php81-mongodb=$pkgver-r$pkgrel" # for backward compatibility
replaces="php81-mongodb" # for backward compatibility

build() {
	phpize81
	./configure --prefix=/usr \
		--with-php-config=/usr/bin/php-config81
	make
}

check() {
	# tests requires additional dependencies (vagrant)
	php81 -d extension=modules/$_extname.so --ri $_extname
}

package() {
	make INSTALL_ROOT="$pkgdir" install

	local _confdir="$pkgdir"/etc/php81/conf.d
	install -d $_confdir
	echo "extension=$_extname" > $_confdir/$_extname.ini
}

sha512sums="
3224ea4efac1063bea58c55c2defbb149982b88387917a1301e08b65c2bbb070d962a17bc84d187abeed8950a52e5e5d24e5517524d8bf0892ecd3f6c9f815f0  php-pecl-mongodb-1.18.1.tgz
"
